(function ($) {
    'use strict';


    // ------------------------------------------------ 轮播图部分 ----------------------------------------------
    let $focusSlider = $('#focus-slider');// 轮播图
    // 加载轮播图图片    index:当前索引 elem:索引对应的元素 success:回调函数
    $focusSlider.on('focus-loadItem', function (e, index, elem, success) {
        let $image = $(elem).find('.slider-img');//elem是div
        $image.loadImages($image, success,
            function () {
                $image.attr('src', 'image/focus-slider/placeholder.png');
            }
        );
    });

    // 执行延迟加载
    $focusSlider.loadUntil({
        $container: $focusSlider,
        totalItemNum: $focusSlider.find('.slider-img').length,
        triggerEvent: 'slider-show',
        id: 'focus'
    });

    // 执行 slider()函数   animation:[fade , slide]
    $focusSlider.slideshow({css3: true, js: false, animation: 'slide', activeIndex: 0, interval: 4000});


    //---------------------------------------------------今日推荐部分 --------------------------------------------
    let $todaySlider = $('#today-slider');
    $todaySlider.on('today-loadItem', function (e, index, elem, success) {
        let $image = $(elem).find('.slider-img');//elem是div
        $image.loadImages($image, success,
            function () {
                $image.attr('src', 'image/today-slider/placeholder.png');
            }
        );
    });

    $todaySlider.loadUntil({
        $container: $todaySlider,
        totalItemNum: $todaySlider.find('.slider-img').length,
        triggerEvent: 'slider-show',
        id: 'today'
    });

    $todaySlider.slideshow({css3: true, js: false, animation: 'slide', activeIndex: 0, interval: 0});
})(jQuery);